/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.pdx.cs.guavalib;

import edu.pdx.cs.guavadata.Guava;
import edu.pdx.cs.guavadata.domain.Domain;
import edu.pdx.cs.guavadata.subclass.ControlType;
import edu.pdx.cs.guavadata.subclass.LaunchType;
import java.awt.Dimension;
import java.awt.Point;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.TableColumn;

/**
 *
 * @author VuTran
 */
public class GTableColumn extends TableColumn implements Guava {

    Domain d;
    String gname = null;

    public GTableColumn() {
        super();
        return;
    }

    GTableColumn(TableColumn oldColumn, String columnName) {
        this();
        this.setGName(columnName);
        this.setDomain(oldColumn.getClass());
    }

    public LaunchType getLType() {
        return LaunchType.NA;
    }

    public ControlType getCType() {
        return ControlType.Attribute;
    }

    public String getGText() {
        return null;
    }

    public String getGName() {
        if (this.gname == null)
            return this.getHeaderValue().toString();
        return this.gname;
    }

    public void setGName(String gName) {
        this.gname = gName;
    }

    public Point getGLocation() {
        return new Point();
    }

    public Dimension getGSize() {
        return new Dimension();
    }

    public List<Guava> getGComponents() {
        return new ArrayList<Guava>();
    }

    public void gBind(String table, int i) {
        return;
    }

    public void gBindFromDatabase(String table, int i) {
        return;
    }

    public String getGDefault() {
        return null;
    }

    public String getGToolTip() {
        return null;
    }

    public Domain getGDomain() {
        if (this.d == null) {
            this.d = new edu.pdx.cs.guavadata.domain.String();
        }
        return this.d;
    }

    public void setGDomain(Domain value) {
        this.d = value;
    }

    public void setDomain(Class c) {
        if (c.equals(String.class)) {
            d = new edu.pdx.cs.guavadata.domain.String();
        } else if (c.equals(Boolean.class)) {
            d = new edu.pdx.cs.guavadata.domain.Boolean();
        } else if (c.equals(Integer.class)) {
            d = new edu.pdx.cs.guavadata.domain.Integer();
        } else if (c.equals(Byte.class)) {
            d = new edu.pdx.cs.guavadata.domain.TinyInteger();
        } else if (c.equals(Short.class)) {
            d = new edu.pdx.cs.guavadata.domain.SmallInteger();
        } else if (c.equals(Long.class)) {
            d = new edu.pdx.cs.guavadata.domain.BigInteger();
        } else if (c.equals(Float.class)) {
            d = new edu.pdx.cs.guavadata.domain.Single();
        } else if (c.equals(Double.class)) {
            d = new edu.pdx.cs.guavadata.domain.Double();
        } else if (c.equals(Object.class)) {
            d = new edu.pdx.cs.guavadata.domain.String();
        }
    }

    public Guava get(String s) {
        return null;
    }

    public String toString() {
        return this.getHeaderValue().toString() + ":" + this.d.toString();
    }
}
